import request from "@/utils/request";

const STRATEGY_BASE_URL = "/sys/log";

const SysAPI = {
  /** 系统日志 */
  SysLog(data?: SysLogQuery) {
    return request<any, SysLogResponse>({
      url: `${STRATEGY_BASE_URL}/page`,
      method: "post",
      data: data,
    });
  },
};

export default SysAPI;

export interface SysLogQuery {
  pageIndex: number;
  pageSize: number;
}

export interface SysLogResponse {
  total: number;
  size: number;
  current: number;
  pages: number;
  data: SysLog[];
}

export interface SysLog {
  id?: number;
  executionTime?: string;
  userId?: number;
  databaseName?: string | null;
  sqlStatement?: string;
  executionStatus?: string;
  errorMessage?: string | null;
  rowsAffected?: number | null;
  executionDurationMs?: number;
  resultPreview?: string;
  executionPlan?: string;
  peakMemoryUsageKb?: number | null;
  rowsReturned?: number;
  resultChecksum?: string | null;
  relatedJobId?: number | null;
  additionalMetadata?: string | null;
}
